package com.jdk.demo.io.read返回负1;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class TcpClient {

	public static void main(String[] a) {
        try {
            Socket skt = new Socket(InetAddress.getLocalHost(), 10001);
            InputStream in = skt.getInputStream();
            OutputStream out = skt.getOutputStream();
            while (true) {
                byte[] b = new byte[100];
                int c = in.read(b);
                System.out.println(c);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
